home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
- ADOBE SYSTEMS INCORPORATED
- Copyright 2002 Adobe Systems Incorporated
- All Rights Reserved
-
- NOTICE: Adobe permits you to use, modify, and distribute this
- file in accordance with the terms of the Adobe license agreement
- accompanying it. If you have received this file from a source
- other than Adobe, then your use, modification, or distribution
- of it requires the prior written permission of Adobe.
- ***************************************************************/
- /***************************************************************
- Author: Mary Obelnicki
- ***************************************************************/
-
- /***************************************************************
-
- The following script creates a key frame animation effect on
- the currently selected objects.
-
- Function:
- zoomenter(letters, frames, stagger, opacity, rotation, xdiff, ydiff, zdiff, forward, startNow, KFR)
-
- Arguments:
- <letters> LMObject - an array of the objects to apply the
- effect. Does not have to be text objects. It can be
- any LMObject.
- <frames> integer - the length of the animation for each
- object
- <stagger> integer - the number of frames to stagger the
- start of each animation
- <opacity> integer - the opacity to start at
- <rotation> integer - the rotation to end at
- <xdiff>, <ydiff>, <zdiff> integer - the x,y,z difference
- from the initial position to end at. In 3-d space.
- <forward> boolean - stagger from first character or
- last character
- <KFR> integer - the number of frames between key frames.
-
- ***************************************************************/
-
- #include "../../Include/Camera.js"
-
- /***************************************************************
- To change the behavior of this script, make your changes below
- ***************************************************************/
-
- var objects = application.currentComposition.selection;
- zoomenter(objects, 12, 2, 0, -360, 0, 0, 2000, true, true, 3);
-
- /***************************************************************
- DO NOT EDIT BELOW THIS LINE
- ***************************************************************/
-
- function zoomenter(letters, frames, stagger, opacity, rotation, xdiff, ydiff, zdiff, forward, startNow, KFR)
- {
- if(letters.length < 1)
- return;
- keyFrameRate = KFR;
-
- // set up the camera
- // this sets the position of the eye at the same x and y as the middle object in the letters array.
- var midIndex = Math.ceil((letters.length)/2) -1;
- var xe = letters[midIndex].position.x;
- var ye = letters[midIndex].position.y;
- var camera = new Camera(new Vector(xe, ye, -1000));
-
- // initial conditions
- var frame0;
- if (startNow)
- frame0 = letters[0].currentFrame;
- else
- frame0 = letters[0].currentFrame - (stagger * (letters.length - 1) + frames);
-
- // deltas per frame
- var dxdf = xdiff/frames;
- var dydf = ydiff/frames;
- var dzdf = zdiff/frames;
-
- for (i=0; i < letters.length; i++)
- {
- var cl;
- if (forward)
- cl = letters[i];
- else
- cl = letters[letters.length -1 -i];
- var xo = cl.position.x;
- var yo = cl.position.y;
- var zo = 0; // allow this as an input parameter?
- var oriOpacity = cl.opacity;
- var oriRotation = cl.rotation;
-
- //turn on relevant stopwatches
-
- if (opacity != oriOpacity)
- cl.stopwatch.opacity = true;
- if (rotation != oriRotation)
- cl.stopwatch.rotation = true;
-
- //I'm going to turn on the relevant stopwatches myself
- camera.perspectiveSetup(cl, false);
-
- if (zdiff == 0)
- {// test xdiff and ydiff
- if((xdiff != 0) || (ydiff != 0))
- cl.stopwatch.position = true;
- }
- else
- {
- cl.stopwatch.position = true;
- cl.stopwatch.scale = true;
- }
-
- //first frame
- cl.currentFrame = frame0 + (i * stagger);
- camera.perspectiveTransform(cl, new Vector(xo+xdiff, yo+ydiff, zo+zdiff));
- cl.opacity = opacity;
- cl.rotation = rotation;
-
- if (zdiff != 0)
- {
- //middle frames
- for(df =0; df < frames; df+=keyFrameRate)
- {
- cl.currentFrame = frame0 + df + (i * stagger);
- camera.perspectiveTransform(cl, new Vector(xo+xdiff-(dxdf * df), yo+ydiff-(dydf * df), zo+zdiff-(dzdf * df)));
- }
- }
-
- //last frame
-
- cl.currentFrame = frame0 + frames + (i * stagger);
- camera.perspectiveTransform(cl, new Vector(xo, yo, zo));
- cl.opacity = oriOpacity;
- cl.rotation = oriRotation;
- }
- }
-
-